<template>
	<view class="twoDimensionalArray">
		二维数组
	</view>
</template>

<script>
	export default{
		data(){
			return{
				name:"kangshanshan",
				arr:[
					
				],
			}
		},
		onLoad() {
			this.map()
		},
		methods:{
			map(){
				// let arr = [4, 9, 16, 25]
				// arr.map((item)=>{
				// })
				// 建立空的二维数组
				var blank = [[],[],[]];
				// 创建二维数组
				var arr = [[1,2,3],[4,5,6],[7,8,9]];
				var num = 0;
				// console.log(arr[0])
				// console.log(arr[1][0])
				// console.log(arr[2])
				// 遍历 arr 数组
				for(var i in arr){    
					for(var j in arr[i]){
						// console.log(arr[j] + "j")
						// console.log(arr[i][j] +  "++++++++")
						// num+=arr[i][j];
					}
				}
				// console.log(arr)
				// console.log(num)
				
				
				
				// 去重复
				let person = [					{id:0,name:'小明'},					{id:1,name:'小张'},					{id:1,name:'小李'},					{id:3,name:'小孙'},					{id:4,name:'小明'},					{id:5,name:'小是'},
				]
								let obj = {}
				let cur = []
				person.forEach((item,index)=>{
					let id = item.id
					obj[id] ? "" : obj[id] = true && cur.push(item.name)
					return cur;
				})
				person = cur
				
				
				function A(name,age){
				  this.name = name
				  this.age = age
				}
				var b = new A('b',"12")
				console.log(b)
				var a = new A('a',"18")
				console.log(a)
							}
		}
	}
</script>

<style>
	page{
		font-size: 30rpx;
		padding: 0 30rpx;
		background: #f5f5f5;
		padding-top: 20rpx;
	}
	
	
	.title{
		text-align: center;
		padding: 20rpx;
	}
	.ref{
		border: 1px #ccc solid;
	}
</style>
